import math

n = int(input())
fac_sum = 0
for i in range(1, n + 1):
    fac_sum += math.factorial(i)
print(fac_sum)
